package com.ioc.config;

import com.ioc.autowried.person;
import com.ioc.dao.UserDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @author cyt
 * @create 2020-07-30 下午 10:55
 */
@ComponentScan(
        basePackages = {
                "com.ioc.dao",
                "com.ioc.service",
                "com.ioc.autowried"
        }
)
@Configuration
public class MyConfigAutowried {

    /**
     * spring 定义的自动装配注解
     *
     * @autowried
     * @primary
     * @Qualifier java 规范的支持自动装配的注解
     * @Resource(name = "userDao1")
     * @inject()
     */
    @Primary
    @Bean("userDao1")
    public UserDao userDao() {
        return new UserDao();
    }

    @Bean
    public person person() {
        return new person();
    }
}
